<template>
  <div class="check-in-status">
    <div
      class="under_review"
      v-if="status === 0"
    >
      <div><img src="./../../assets/images/checkIn/under_review.png" /></div>
      <div>
        您的资料正在审核中，请保持联系人手机号码畅通，客户经理将尽快给您致电。
      </div>
    </div>
    <div
      class="audit_failed"
      v-if="[-1,2].includes(status)"
    >
      <img src="./../../assets/images/checkIn/audit_failed.png" />
      <div>您的资料未通过审核，请重新提交相关资料</div>
      <div class="note-content">
        <div
          class="note"
          v-for="(text, index) in failMsg"
          :key="index"
        >
          {{ text }}
        </div>
      </div>
      <div>
        <el-button
          type="primary"
          plain
          @click="go"
        >编辑资料</el-button>
      </div>
    </div>
    <div
      class="under_review"
      v-if="status === 1"
    >
      <div><img src="./../../assets/images/checkIn/passed.png" /></div>
      <div>
       您的资料已通过审核，请期待系统上线。
      </div>
    </div>
  </div>
</template>
<script>
import { getCompanyInfo } from "@/api/CheckIn";
export default {
  name: "CheckInStatus",
  data() {
    return {
      status: 9999,
      failMsg: [],
    };
  },
  created() {
    this.init();
  },
  methods: {
    async init() {
      //0待审核，1已通过，2已拒绝
      let { checkState, failMsg } = await getCompanyInfo();
      this.status = checkState;
      this.failMsg = failMsg.split(";") || [];
    },
    go() {
      this.$router.replace({
        path: "check-in",
      });
    },
  },
};
</script>
<style lang="less" scoped>
.check-in-status {
  background: #fff;
  height: 100%;
  border-radius: 4px;

  .under_review,
  .audit_failed {
    flex-flow: column;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #303133;
    .note-content {
      margin: 10px 0 30px;
      line-height: 17px;
    }
    .note {
      font-size: 12px;
      color: #909399;
      text-align: center;
    }
  }
}
</style>
